
  <title>商品管理</title>
  <div class="layui-card">
    <div class="layui-card-body">
      <div class="layui-tab layui-tab-brief" lay-filter="goods-list-tabs">
        <ul class="layui-tab-title" style="margin-bottom: 10px;">
        	<li class="layui-this">全部</li>
          <li>不回收</li>
          <li>已支持回收</li>
        </ul>
        <div class="layui-tab-content">
          <div class="layui-tab-item layui-show" id="status1">
            <table id="LAY-good-list-status1" lay-filter="LAY-good-list-status1"></table>
          </div>
          <div class="layui-tab-item" id="status2">
              <table id="LAY-good-list-status2" lay-filter="LAY-good-list-status2"></table>
          </div>
          <div class="layui-tab-item" id="status3">
              <table id="LAY-good-list-status3" lay-filter="LAY-good-list-status3"></table>
          </div>
          <script type="text/html" id="LAY-good-list-table-img">
            <img src="{{d.image}}" alt="" style="width:80px; height: 110px;">
          </script>
          <script type="text/html" id="LAY-good-list-recycle">
            <p>{{parseInt(d.is_recycle) ==1?'回收':'不回收'}}</p>
          </script>
        </div>
      </div>
    </div>
  </div>
<script>
layui.use(['admin', 'table', 'form', 'upload'], function(){
    var table = layui.table
    ,form = layui.form
    ,admin = layui.admin
    ,upload = layui.upload
    ,view = layui.view
    ,element = layui.element
    ,$ = layui.$
    ,curr_tab = 0 //当前tab索引
	,cols = [
		[
			{
				align: 'center',
				width: 120,
				templet: '#LAY-good-list-table-img',
				title: '封面图',
				field: 'image'
			}, {
				align: 'center',
				field: 'title',
				title: '书名',
			}, {
				align: 'center',
				field: 'author',
				title: '作者',
			}, {
				align: 'center',
				field: 'publish_time',
				title: '出版时间'
			}, {
				align: 'center',
				field: 'isbn',
				title: 'ISBN'
			}, {
				align: 'center',
				field: 'feedback_recyle_count',
				title: '提交建议人数'
			},{
				align: 'center',
				field: 'is_recycle',
				templet: '#LAY-good-list-recycle',
				title: '当前回收状态'
			}
		]
	];
	table.set({
		headers: { //通过 request 头传递
			'access-token': layui.data('layuiAdmin').access_token
		}
	});

	table.render({
		elem: '#LAY-good-list-status3',
		url: 'https://bookshop.dingdangtoy.com/api/admin/book/feedback_recyle_list?type=2',
		parseData: function(res) { //res 即为原始返回的数据
			return {
				"code": res.code, //解析接口状态
				"msg": res.message, //解析提示文本
				"count": res.data._meta.total_count, //解析数据长度
				"data": res.data.items //解析数据列表
			}
		},
		cols: cols,
		page: true
	});
	table.render({
		elem: '#LAY-good-list-status2',
		url: 'https://bookshop.dingdangtoy.com/api/admin/book/feedback_recyle_list?type=1',
		parseData: function(res) { //res 即为原始返回的数据
			return {
				"code": res.code, //解析接口状态
				"msg": res.message, //解析提示文本
				"count": res.data._meta.total_count, //解析数据长度
				"data": res.data.items //解析数据列表
			}
		},
		cols: cols,
		page: true
	});

	table.render({
		elem: '#LAY-good-list-status1',
		url: 'https://bookshop.dingdangtoy.com/api/admin/book/feedback_recyle_list?type=0',
		parseData: function(res) { //res 即为原始返回的数据
			return {
				"code": res.code, //解析接口状态
				"msg": res.message, //解析提示文本
				"count": res.data._meta.total_count, //解析数据长度
				"data": res.data.items //解析数据列表
			}
		},
		cols: cols,
		page: true
	});
	// 监听tab切换
	element.on('tab(goods-list-tabs)', function(data) {
		curr_tab = data.index
	});


  });
</script>
  <style type="text/css">
  	.layui-table-cell, .layui-table-tool-panel li{white-space: inherit !important;}
  	.sp1{float: left;}
  	.sp2{float: left;width: 16px;margin-top: 5px;height: 16px;text-align: center;line-height: 16px;font-size: 14px;color: #ccc;border: 1px solid #ccc;border-radius: 50%;margin-left: 15px;cursor: pointer;}
  </style>
